package com.kingyun.gpsinspection.purificationservice.services.activitiservice.ext.parser;

import org.activiti.bpmn.model.BaseElement;
import org.activiti.engine.impl.bpmn.parser.BpmnParse;
import org.activiti.engine.impl.bpmn.parser.handler.UserTaskParseHandler;
import org.activiti.engine.parse.BpmnParseHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * 自定义用户任务解析器
 * @author zjh
 * @since 20170609
 */
public class CustomerUserTaskBpmnParserHandler extends UserTaskParseHandler {

    private static Logger logger = LoggerFactory.getLogger(CustomerUserTaskBpmnParserHandler.class);

    //自定义解析器
    private List<BpmnParseHandler> bpmnParseHandlers = new ArrayList<BpmnParseHandler>();



    @Override
    public void parse(BpmnParse bpmnParse, BaseElement element) {
        logger.info("bpmnParseHandlers : {}", bpmnParseHandlers);
        for (BpmnParseHandler bpmnTaskParseHandler : bpmnParseHandlers) {
            logger.info("bpmnTaskParseHandler : {}", bpmnTaskParseHandler);
            bpmnTaskParseHandler.parse(bpmnParse, element);
        }
    }



    public void setBpmnParseHandlers(List<BpmnParseHandler> bpmnParseHandlers) {
        this.bpmnParseHandlers = bpmnParseHandlers;
    }
}
